Retrieving text from password field [python][pyqt4]

Posted by Dr. Johnson on Stack Overflow See other posts from Stack Overflow or by Dr. Johnson
Published on 2010-01-26T18:56:25Z Indexed on 2010/04/12 22:02 UTC
Read the original article Hit count: 315

Filed under:
|
|
|
def welcomeStage (self):        
    self.test = QtGui.QLineEdit (self)
    self.test.move (50, 150)

    QtCore.QObject.connect (self.test, QtCore.SIGNAL ('returnPressed()'), self.passwordStage)

def passwordStage (self):
    self.email = self.test.text()
    self.test.clear()
    self.test.setEchoMode (QtGui.QLineEdit.Password)
    QtCore.QObject.connect (self.test, QtCore.SIGNAL ('returnPressed()'), self.loginStage)

def loginStage (self):
    self.pwd = self.test.text()
    print self.pwd
    if len (self.pwd) < 0:
        welcomeStage ()
        return

Simply put, I am making a login form. The user enters their email, then the text field is cleared and echo mode is set to Password mode. The text() function returns the email fine, but when I call text() after I have changed the echo mode, it returns 0. I've been pouring over the documentation looking for anything regarding the text() function and how it operates when Password mode is on, however I have not found anything. Does anybody know how this is done?

© Stack Overflow or respective owner

Related posts about python

Related posts about pyqt4